package com.bala.training;

import java.util.*;

class Cat {
	public String name;
	Cat(String name) {
		this.name = name;
	}
}

public class IterTest {

	public static void main(String[] args) {
		List<Cat> c = new ArrayList<Cat>();
		Cat cat = new Cat("Aiko");
		c.add(cat);
		c.add(new Cat("clover"));
		c.add(new Cat("magnolia"));
		Iterator<Cat> i = c.iterator();
		while(i.hasNext()) {
			Cat c2 = i.next();
			System.out.println(c2.name);
		}
		System.out.println("Size : "+ c.size());
		System.out.println("Get 1 : "+ c.get(1).name);
		System.out.println("aiko : "+ c.indexOf(cat));
		c.remove(2);
		Object[] ob = c.toArray();
		for(Object o : ob) {
			Cat c2 = (Cat) o;
			System.out.println("ob : "+ c2.name);
		}
	}

}